package com.hmall.api.fallback;

import com.hmall.api.controller.OrderClient;
import com.hmall.common.exception.BizIllegalException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

@Slf4j
public class OrderClientFallbackFactory implements FallbackFactory<OrderClient> {

    @Override
    public OrderClient create(Throwable cause) {
        return new OrderClient() {
            @Override
            public void markOrderPaySuccess(Long orderId) {
                log.error("标记支付成功状态失败",cause);
                throw new BizIllegalException(cause);
            }
        };
    }
}
